package com.ruoyi.project.system.word.domain;

import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.security.ShiroUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.framework.web.domain.BaseEntity;

import java.util.Date;
import java.util.UUID;

/**
 * 系统文档管理表 sys_word
 *
 * @author lxs
 * @date 2018-10-17
 */
public class Word {
    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    private String id;
    /**
     * 创建者
     */
    private String createBy;
    /**
     * 创建时间
     */
    private Date createDate;
    /**
     * 更新者
     */
    private String updateBy;
    /**
     * 更新时间
     */
    private Date updateDate;
    /**
     * 备注信息
     */
    private String remarks;
    /**
     * 逻辑删除标记（0：显示；1：隐藏）
     */
    private String delFlag;
    /**
     * 键/类型
     */
    private String type;
    /**
     * 内容类型（HTML、FILE、TEXT、LINK）
     */
    private String mode;
    /**
     * 标签
     */
    private String label;
    /**
     * 标题
     */
    private String title;
    /**
     * 内容
     */
    private String content;
    /**
     * 链接
     */
    private String link;
    /**
     * 文件路径
     */
    private String path;
    /**
     * 页面
     */
    private String html;
    /**
     * 顺序
     */
    private String sort;
    /**
     * 业务id
     */
    private String mid;
    /**
     * 发布时间
     */
    private Date release;
    /**
     * 发布状态（1.未发布，2.待发布，3.已发布）
     */
    private Integer status;
    /**
     * 是否可以删除
     */
    private Integer del;
    /**
     * 授权修改字段
     */
    private String permission;
    /**
     * 预留字段
     */
    private String reserve;
    /**
     * 备用字段
     */
    private String spare;

    public void setId(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public String getCreateBy() {
        return createBy;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setDelFlag(String delFlag) {
        this.delFlag = delFlag;
    }

    public String getDelFlag() {
        return delFlag;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getType() {
        return type;
    }

    public String getMode() {
        return mode;
    }

    public void setMode(String mode) {
        this.mode = mode;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public String getLabel() {
        return label;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getTitle() {
        return title;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getContent() {
        return content;
    }

    public void setLink(String link) {
        this.link = link;
    }

    public String getLink() {
        return link;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getPath() {
        return path;
    }

    public void setHtml(String html) {
        this.html = html;
    }

    public String getHtml() {
        return html;
    }

    public void setSort(String sort) {
        this.sort = sort;
    }

    public String getSort() {
        return sort;
    }

    public void setMid(String mid) {
        this.mid = mid;
    }

    public String getMid() {
        return mid;
    }

    public void setRelease(Date release) {
        this.release = release;
    }

    public Date getRelease() {
        return release;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getStatus() {
        return status;
    }

    public void setDel(Integer del) {
        this.del = del;
    }

    public Integer getDel() {
        return del;
    }

    public void setPermission(String permission) {
        this.permission = permission;
    }

    public String getPermission() {
        return permission;
    }

    public void setReserve(String reserve) {
        this.reserve = reserve;
    }

    public String getReserve() {
        return reserve;
    }

    public void setSpare(String spare) {
        this.spare = spare;
    }

    public String getSpare() {
        return spare;
    }

    public void preInsert(String uid) {
        this.id = UUID.randomUUID().toString().replaceAll("-", "");
        this.createBy = StringUtils.isNotBlank(uid) ? uid : ShiroUtils.getLoginName();
        if (this.del == null) this.del = 0;
        this.updateBy = this.createBy;
        this.createDate = new Date();
        this.updateDate = this.createDate;
        this.delFlag = "0";
        this.status = 1;
    }

    public void preUpdate(String uid) {
        this.updateBy = StringUtils.isNotBlank(uid) ? uid : ShiroUtils.getLoginName();
        this.updateDate = new Date();
    }

    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("createBy", getCreateBy())
                .append("createDate", getCreateDate())
                .append("updateBy", getUpdateBy())
                .append("updateDate", getUpdateDate())
                .append("remarks", getRemarks())
                .append("delFlag", getDelFlag())
                .append("type", getType())
                .append("label", getLabel())
                .append("title", getTitle())
                .append("content", getContent())
                .append("link", getLink())
                .append("path", getPath())
                .append("html", getHtml())
                .append("sort", getSort())
                .append("mid", getMid())
                .append("release", getRelease())
                .append("status", getStatus())
                .append("del", getDel())
                .append("permission", getPermission())
                .append("reserve", getReserve())
                .append("spare", getSpare())
                .toString();
    }
}
